{% extends 'default/base.html' %}
{% load humanize %}
{% block content %}
<div class="wrapper wrapper-content">
    <div class="row">
        {% include "ztree/ztree_js.html" %}
        <div class="col-lg-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-info pull-right">Hosts</span>
                    <h5>主机总数</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins"><a href="/assets/host_list/">{{ hosts }}</a></h1>
                    <div class="stat-percent font-bold text-info"> <i class="fa fa-level-up"></i></div>
                    <small>All host</small>
                </div>
            </div>
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">Users</span>
                    <h5>用户总数</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins"><a href="{% url 'user_list' %}">{{ users }}</a></h1>
                    <div class="stat-percent font-bold text-success">{{ percent_user }} <i class="fa fa-bolt"></i></div>
                    <small>All user</small>
                </div>
            </div>

            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">count</span>
                    <h5>当天项目发布统计</h5>
                </div>
                {% for k,v in swan_data.items %}
                <div class="ibox-content">
{#                    <h5 class="no-margins">{{ k }}发布:</h5>#}
                    <div class="stat-percent font-bold text-success">{{ v.count }} 次</div>
                    <small><a href="{% url 'SwanSelectLog' v.uuid %}?date={{ stop_time| date:"Y-m-d" }}">{{ k }} </a></small>
                </div>
                {% endfor %}
            </div>

        </div>
        <div class="col-lg-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-danger pull-right">Problems</span>
                    <h5>故障总数</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins"><a href="{% url 'FaultNoDone' %}">{{ problems }}</a></h1>
                    <div class="stat-percent font-bold text-navy"> <i class="fa fa-level-up"></i></div>
                    <small>All Problems</small>
                </div>
            </div>
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-info pull-right">Project</span>
                    <h5>项目数</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins"><a href="{% url 'project_list' %}">{{ project }}</a></h1>
                    <div class="stat-percent font-bold text-navy"> <i class="fa fa-level-up"></i></div>
                    <small>All Problems</small>
                </div>
            </div>

        </div>

        <div class="col-lg-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-info pull-right">swan</span>
                    <h5>发布日志</h5>
                </div>
                <div class="ibox-content inspinia-timeline">
                    {% for i in swan_log %}
                    <div class="timeline-item">
                        <div class="row">
                            <div class="col-xs-3 date">
                                <i class="fa fa-pied-piper-alt"></i>
                                <small class="text-navy">{{ i.swan_datetime|naturaltime }}</small>
                            </div>
                            <div class="col-xs-7 content no-top-border">
                                <p class="m-b-xs"><strong><span class="label label-danger">{{ i.username }}</span> </strong></p>
                                <p>发布: {{ i.project_name }}</p>
                                <p>{{ i.swan_name }} -> {{ i.module_name }}分支</p>
                                <p>状态: {{ i.message }}</p>
                                {% if i.update_log %}
                                <p>更新内容: {{ i.update_log|linebreaksbr }}</p>
                                {% endif %}
                                <p>{{ i.swan_datetime }}</p>
                            </div>
                        </div>
                    </div>
                    {% endfor %}
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock  %}

